<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>DelCookie</title>
</head>
<body>
		<%
		if(request.getParameter("exit")!=null){
			//获取cookie
			Cookie[] cookies=request.getCookies();

			for(Cookie cookie: cookies){

			    cookie.setMaxAge(0);

			    cookie.setPath("/");  //路径一定要写上，不然销毁不了

			    response.addCookie(cookie);}
			
				response.sendRedirect("CRUD.jsp");    
			    //response.setHeader("refresh", "0;url='CRUD.jsp'");   
		}else{
		session.removeAttribute("loginuser");
		response.setHeader("refresh", "0;url='CRUD.jsp'");}%>
</body>
</html>